<!DOCTYPE html>
<html>
<head>
    <title>SSE Example</title>
</head>
<body>
    <div id="status"></div>

    <script>
        const source = new EventSource('/start-async-task-sse');

        source.onmessage = function(event) {
            document.getElementById('status').innerText = event.data;
        };

        source.onerror = function(event) {
            console.error("EventSource failed:", event);
            source.close();
        };
    </script>
</body>
</html>
